import {Component, OnInit} from '@angular/core';
import {ActivatedRoute, Router} from '@angular/router';
import {SampleService} from "../sample.service";
import {SettingUrl} from "../../../public/setting/setting_url";

@Component({
  selector: 'app-sample-detail',
  templateUrl: './sample-detail.component.html',
  styleUrls: ['./sample-detail.component.css']
})
export class SampleDetailComponent implements OnInit {
  private code: string;
  public sampleInfo: any = {};//sample信息

  constructor(private sampleService: SampleService, private route: ActivatedRoute, private router: Router) {
  }

  ngOnInit() {
    this.code = this.route.snapshot.params.code;//获取参数
    this.loadSampleInfo();//查询sample类型列表
  }

  /**
   * 查询sample信息
   */
  loadSampleInfo() {
    this.sampleService.loadSampleByCode(this.code).then((data: any) => {
      if (data) this.sampleInfo = data;
    })
  }

  /**
   * 修改未设置数据
   */
  toModifyTheUnSetData() {
    this.router.navigate([SettingUrl.ROUTERLINK.sample.modify, this.code])
  }

}
